package cn.kgc.spring.shop.controller;

import cn.kgc.spring.shop.entity.R;
import cn.kgc.spring.shop.entity.User;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
public class UserController {
    @PostMapping("/user/login")
    public R login(@RequestBody User user){
        return  R.ok().data("token","admin");
    }
    //给前端返回值
    @GetMapping("/user/info")
    public R info(String token){
        return R.ok().data("roles","admin").data("name","admin").data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
    //退出登录
    @PostMapping("/user/logout")
    public R logout(){
        return  R.ok();
    }
}
